home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / plplot26 / part05 < prev    next >
Encoding:
Internet Message Format  |  1990-01-14  |  58.4 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i006: plplot 2.6 - C library for making scientific plots, Part05/12
  5. Message-ID: <10978@xanth.cs.odu.edu>
  6. Date: 14 Jan 90 23:21:59 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: Anthony M. Richardson <amr@dukee.egr.duke.edu>
  9. Lines: 2491
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11.  
  12. Submitted-by: Anthony M. Richardson <amr@dukee.egr.duke.edu>
  13. Posting-number: Volume 90, Issue 006
  14. Archive-name: applications/plplot-2.6/part05
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 5 (of 12)."
  23. # Contents:  drivers/aegis.c drivers/dispatch.c drivers/iff.c
  24. #   src/global.c src/plcntr.c src/plfill.c src/plzbx.c unix/dispatch.c
  25. #   unix/impress.c unix/laserjetii.c
  26. # Wrapped by tadguy@xanth on Sun Jan 14 18:11:35 1990
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'drivers/aegis.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'drivers/aegis.c'\"
  30. else
  31. echo shar: Extracting \"'drivers/aegis.c'\" \(4782 characters\)
  32. sed "s/^X//" >'drivers/aegis.c' <<'END_OF_FILE'
  33. X/* This file contains drivers for the HP7475A plotter */
  34. X
  35. X#include "plplot.h"
  36. X#include <stdio.h>
  37. X#include <string.h>
  38. X
  39. X#define AEGX       10000
  40. X#define AEGY       10000
  41. X
  42. Xstatic FILE *OutDev;
  43. Xstatic PLINT select=0;
  44. Xstatic char FileName[80];
  45. Xstatic short *buffptr, bufflen;
  46. X#define BSIZE  25
  47. X
  48. Xvoid aegissetup(xdpi, ydpi, xwid, ywid)
  49. XPLINT xwid, ywid;
  50. XPLFLT xdpi, ydpi;
  51. X{
  52. X}
  53. X
  54. Xvoid aegisselect(ori, name)
  55. XPLINT ori;
  56. Xchar *name;
  57. X{
  58. X   strncpy(FileName,name,sizeof(FileName)-1);
  59. X   FileName[sizeof(FileName)-1] = '\0';
  60. X   select = 1;
  61. X}
  62. X
  63. X/* Set up device specific stuff and initialize the device */
  64. Xvoid aegisinit()
  65. X{
  66. X   /* setpxl() sets the dots/mm in the x and y directions */
  67. X   setpxl((PLFLT)39.37, (PLFLT)39.37);
  68. X
  69. X   /* setphy() sets the device coordinates. These are integer */
  70. X   /* values. Set up for landscape orientation (long axis of page in the */
  71. X   /* x direction). Origin is in the lower left hand corner. */
  72. X   setphy(0,AEGX,0,AEGY);
  73. X
  74. X   /* Set default pen color using scol(color). */
  75. X   /* Any default pen color can be used but a black pen is probably best. */
  76. X   scol(1);
  77. X
  78. X   /* Set default pen width using swid(width) */
  79. X   swid(1);
  80. X
  81. X   /* Set device interaction mode using smod(mode). Set mode to 0 for */
  82. X   /* a noninteractive device, Unless you are writing your */
  83. X   /* own Amiga screen driver mode should be 0. */
  84. X   smod(0);
  85. X
  86. X   bufflen = 2*BSIZE;
  87. X   buffptr = (short *)malloc(sizeof(short)*bufflen);
  88. X   if(buffptr == NULL)
  89. X      plexit("Out of memory!");
  90. X
  91. X}
  92. X
  93. X/* Sets to text mode */
  94. Xvoid aegistext()
  95. X{
  96. X}
  97. X
  98. X/* Sets to graphics mode */
  99. Xvoid aegisgraph()
  100. X{
  101. X}
  102. X
  103. Xstatic PLINT firstline;
  104. X/* Clears the page */
  105. Xvoid aegisclear()
  106. X{
  107. X   void flushbuffer();
  108. X
  109. X   /* Close the file */
  110. X   if(!firstline) {
  111. X      flushbuffer();
  112. X   }
  113. X   fclose(OutDev);
  114. X}
  115. X
  116. Xstatic short xlast, ylast;
  117. X
  118. Xvoid aegispage()
  119. X{
  120. X   char line[80];
  121. X   for(;;) {
  122. X      if(!select) {
  123. X         printf("Enter graphics file name. ");
  124. X         fgets(line,sizeof(line),stdin);
  125. X         if(sscanf(line,"%s",FileName)!=1)
  126. X            continue;
  127. X      }
  128. X
  129. X      if (!(OutDev = fopen(FileName,"w"))) {
  130. X         fprintf(stderr,"Can't open %s.\n",FileName);
  131. X         select = 0;
  132. X      }
  133. X      else
  134. X         break;
  135. X   }
  136. X   select = 0;
  137. X   firstline = 1;
  138. X   xlast = -10000; ylast = -10000;
  139. X
  140. X   /* Write out header */
  141. X   fprintf(OutDev,"81086 0.0 0.0 100.0 100.0 0 10.\n");
  142. X   fprintf(OutDev,"\"%s\"\n-1\n",FileName);
  143. X}
  144. X
  145. Xstatic int curwid;
  146. Xvoid aegiswidth(width)
  147. XPLINT width;
  148. X{
  149. X   void flushbuffer();
  150. X
  151. X   flushbuffer();
  152. X   firstline = 1;
  153. X
  154. X   if(width <= 1)
  155. X      curwid = 0;
  156. X   else if(width >= 4)
  157. X      curwid = 3;
  158. X   else
  159. X      curwid = width-1;
  160. X}
  161. X
  162. Xstatic int curcol;
  163. X/* Change the pen color */
  164. Xvoid aegiscolor(color)
  165. XPLINT color;
  166. X{
  167. X   void flushbuffer();
  168. X
  169. X   flushbuffer();
  170. X   firstline = 1;
  171. X   /* Aegis pen 1 is the "paper" color */
  172. X   if (color >= 2 && color <=15)
  173. X      curcol = color;
  174. X   else
  175. X      curcol = 0;
  176. X}
  177. X
  178. Xstatic short count, xmin, xmax, ymin, ymax;
  179. X
  180. X/* Draws a line from (x1,y1) to (x2,y2) */
  181. Xvoid aegisline(x1,y1,x2,y2)
  182. XPLINT x1,y1,x2,y2;
  183. X{
  184. X   short *tempptr;
  185. X   void flushbuffer();
  186. X
  187. X   /* If starting point of this line is the same as the ending point of */
  188. X   /* the previous line then don't raise the pen. (This really speeds up */
  189. X   /* plotting and reduces the size of the file. */
  190. X   if(firstline) {
  191. X      count = 0;
  192. X      *(buffptr+count++) = x1;
  193. X      *(buffptr+count++) = y1;
  194. X      *(buffptr+count++) = x2;
  195. X      *(buffptr+count++) = y2;
  196. X      xmin = min(x1,x2); ymin = min(y1,y2);
  197. X      xmax = max(x1,x2); ymax = max(y1,y2);
  198. X      firstline = 0;
  199. X   }
  200. X   else if(x1 == xlast && y1 == ylast) {
  201. X      if(count+2 >= bufflen) {
  202. X         bufflen += 2*BSIZE;
  203. X         tempptr = (short *)realloc((void *)buffptr,bufflen*sizeof(short));
  204. X         if(tempptr == NULL){
  205. X            free((void *)buffptr);
  206. X            plexit("Out of memory!");
  207. X         }
  208. X         buffptr = tempptr;
  209. X      }
  210. X      *(buffptr+count++) = x2;
  211. X      *(buffptr+count++) = y2;
  212. X      xmin = min(x2,xmin); ymin = min(y2,ymin);
  213. X      xmax = max(x2,xmax); ymax = max(y2,ymax);
  214. X   }
  215. X   else {
  216. X      flushbuffer();
  217. X      *(buffptr+count++) = x1;
  218. X      *(buffptr+count++) = y1;
  219. X      *(buffptr+count++) = x2;
  220. X      *(buffptr+count++) = y2;
  221. X      xmin = min(x1,x2); ymin = min(y1,y2);
  222. X      xmax = max(x1,x2); ymax = max(y1,y2);
  223. X   }
  224. X
  225. X   xlast = x2;
  226. X   ylast = y2;
  227. X}
  228. X
  229. Xstatic void flushbuffer()
  230. X{
  231. X   short i=0;
  232. X
  233. X   fprintf(OutDev,"1 52 %.2f %.2f",xmin/100.,ymin/100.);
  234. X   fprintf(OutDev," %.2f %.2f",xmax/100.,ymax/100.);
  235. X   fprintf(OutDev," %d 0 0 %d 0\n",curcol,curwid);
  236. X   while(i<count) {
  237. X     fprintf(OutDev," 1 %.2f %.2f\n",*(buffptr+i)/100.,*(buffptr+i+1)/100.);
  238. X     i += 2;
  239. X   }
  240. X   fprintf(OutDev," 0\n");
  241. X   count = 0;
  242. X}
  243. X
  244. X/* Cleanup and close file. */
  245. Xvoid aegistidy()
  246. X{
  247. X   flushbuffer();
  248. X   free((VOID *)buffptr);
  249. X   fclose(OutDev);
  250. X}
  251. X
  252. X
  253. X
  254. END_OF_FILE
  255. if test 4782 -ne `wc -c <'drivers/aegis.c'`; then
  256.     echo shar: \"'drivers/aegis.c'\" unpacked with wrong size!
  257. fi
  258. # end of 'drivers/aegis.c'
  259. fi
  260. if test -f 'drivers/dispatch.c' -a "${1}" != "-c" ; then 
  261.   echo shar: Will not clobber existing file \"'drivers/dispatch.c'\"
  262. else
  263. echo shar: Extracting \"'drivers/dispatch.c'\" \(4680 characters\)
  264. sed "s/^X//" >'drivers/dispatch.c' <<'END_OF_FILE'
  265. X#include "plplot.h"
  266. X#include "dispatch.h"
  267. X
  268. Xvoid amisetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  269. Xvoid amiselect PLARGS((PLINT or, char *file));
  270. Xvoid amiinit PLARGS((void));
  271. Xvoid amiline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  272. Xvoid amiclear PLARGS((void));
  273. Xvoid amipage PLARGS((void));
  274. Xvoid amitidy PLARGS((void));
  275. Xvoid amicolor PLARGS((PLINT color));
  276. Xvoid amitext PLARGS((void));
  277. Xvoid amigraph PLARGS((void));
  278. Xvoid amiwidth PLARGS((PLINT width));
  279. X
  280. Xvoid prefsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  281. Xvoid prefselect PLARGS((PLINT or, char *file));
  282. Xvoid prefinit PLARGS((void));
  283. Xvoid prefline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  284. Xvoid prefclear PLARGS((void));
  285. Xvoid prefpage PLARGS((void));
  286. Xvoid preftidy PLARGS((void));
  287. Xvoid prefcolor PLARGS((PLINT color));
  288. Xvoid preftext PLARGS((void));
  289. Xvoid prefgraph PLARGS((void));
  290. Xvoid prefwidth PLARGS((PLINT width));
  291. X
  292. Xvoid iffsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  293. Xvoid iffselect PLARGS((PLINT or, char *file));
  294. Xvoid iffinit PLARGS((void));
  295. Xvoid iffline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  296. Xvoid iffclear PLARGS((void));
  297. Xvoid iffpage PLARGS((void));
  298. Xvoid ifftidy PLARGS((void));
  299. Xvoid iffcolor PLARGS((PLINT color));
  300. Xvoid ifftext PLARGS((void));
  301. Xvoid iffgraph PLARGS((void));
  302. Xvoid iffwidth PLARGS((PLINT width));
  303. X
  304. Xvoid hp7475setup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  305. Xvoid hp7475select PLARGS((PLINT or, char *file));
  306. Xvoid hp7475init PLARGS((void));
  307. Xvoid hp7475line PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  308. Xvoid hp7475clear PLARGS((void));
  309. Xvoid hp7475page PLARGS((void));
  310. Xvoid hp7475tidy PLARGS((void));
  311. Xvoid hp7475color PLARGS((PLINT color));
  312. Xvoid hp7475text PLARGS((void));
  313. Xvoid hp7475graph PLARGS((void));
  314. Xvoid hp7475width PLARGS((PLINT width));
  315. X
  316. Xvoid aegissetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  317. Xvoid aegisselect PLARGS((PLINT or, char *file));
  318. Xvoid aegisinit PLARGS((void));
  319. Xvoid aegisline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  320. Xvoid aegisclear PLARGS((void));
  321. Xvoid aegispage PLARGS((void));
  322. Xvoid aegistidy PLARGS((void));
  323. Xvoid aegiscolor PLARGS((PLINT color));
  324. Xvoid aegistext PLARGS((void));
  325. Xvoid aegisgraph PLARGS((void));
  326. Xvoid aegiswidth PLARGS((PLINT width));
  327. X
  328. Xvoid pssetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  329. Xvoid psselect PLARGS((PLINT or, char *file));
  330. Xvoid psinit PLARGS((void));
  331. Xvoid psline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  332. Xvoid psclear PLARGS((void));
  333. Xvoid pspage PLARGS((void));
  334. Xvoid pstidy PLARGS((void));
  335. Xvoid pscolor PLARGS((PLINT color));
  336. Xvoid pstext PLARGS((void));
  337. Xvoid psgraph PLARGS((void));
  338. Xvoid pswidth PLARGS((PLINT width));
  339. X
  340. XDISPATCH_TABLE plDispatchTable[] = {
  341. X   /* Amiga routines */
  342. X   {
  343. X      /* This string appears in the device menu list. */
  344. X      "Amiga Window",
  345. X      /* Page Setup routine */
  346. X      amisetup,
  347. X      /* Orientation and file name selection */
  348. X      amiselect,
  349. X      /* Device initialization function pointer. */
  350. X      amiinit,
  351. X      /* Function to draw line between two points */
  352. X      amiline,
  353. X      /* Clear screen (or eject page) function. */
  354. X      amiclear,
  355. X      /* New page set up. */
  356. X      amipage,
  357. X      /* Tidy up device (flush buffers, close file, etc.) */
  358. X      amitidy,
  359. X      /* Function to change pen color. */
  360. X      amicolor,
  361. X      /* Switch to text mode. */
  362. X      amitext,
  363. X      /* Switch to graphics mode. */
  364. X      amigraph,
  365. X      /* Set pen width */
  366. X      amiwidth
  367. X   },
  368. X   {
  369. X      "Preferences Printer",
  370. X      prefsetup,
  371. X      prefselect,
  372. X      prefinit,
  373. X      prefline,
  374. X      prefclear,
  375. X      prefpage,
  376. X      preftidy,
  377. X      prefcolor,
  378. X      preftext,
  379. X      prefgraph,
  380. X      prefwidth
  381. X   },
  382. X   {
  383. X      "IFF Graphics File",
  384. X      iffsetup,
  385. X      iffselect,
  386. X      iffinit,
  387. X      iffline,
  388. X      iffclear,
  389. X      iffpage,
  390. X      ifftidy,
  391. X      iffcolor,
  392. X      ifftext,
  393. X      iffgraph,
  394. X      iffwidth
  395. X   },
  396. X   {
  397. X      "HP7475A Plotter (PLT: device)",
  398. X      hp7475setup,
  399. X      hp7475select,
  400. X      hp7475init,
  401. X      hp7475line,
  402. X      hp7475clear,
  403. X      hp7475page,
  404. X      hp7475tidy,
  405. X      hp7475color,
  406. X      hp7475text,
  407. X      hp7475graph,
  408. X      hp7475width
  409. X   },
  410. X   {
  411. X      "Aegis Draw File",
  412. X      aegissetup,
  413. X      aegisselect,
  414. X      aegisinit,
  415. X      aegisline,
  416. X      aegisclear,
  417. X      aegispage,
  418. X      aegistidy,
  419. X      aegiscolor,
  420. X      aegistext,
  421. X      aegisgraph,
  422. X      aegiswidth
  423. X   },
  424. X   {
  425. X      "PostScript File",
  426. X      pssetup,
  427. X      psselect,
  428. X      psinit,
  429. X      psline,
  430. X      psclear,
  431. X      pspage,
  432. X      pstidy,
  433. X      pscolor,
  434. X      pstext,
  435. X      psgraph,
  436. X      pswidth
  437. X   }
  438. X};
  439. X
  440. Xint npldrivers = (sizeof(plDispatchTable)/sizeof(struct dispatch_table));
  441. END_OF_FILE
  442. if test 4680 -ne `wc -c <'drivers/dispatch.c'`; then
  443.     echo shar: \"'drivers/dispatch.c'\" unpacked with wrong size!
  444. fi
  445. # end of 'drivers/dispatch.c'
  446. fi
  447. if test -f 'drivers/iff.c' -a "${1}" != "-c" ; then 
  448.   echo shar: Will not clobber existing file \"'drivers/iff.c'\"
  449. else
  450. echo shar: Extracting \"'drivers/iff.c'\" \(4271 characters\)
  451. sed "s/^X//" >'drivers/iff.c' <<'END_OF_FILE'
  452. X/* IFF file driver. Supplied by Tomas Rokicki (Radical Eye Software) */
  453. X
  454. X#include "plplot.h"
  455. X#include <stdio.h>
  456. X
  457. Xstatic FILE *OutFile;
  458. Xstatic PLINT orient, setup=0, select=0, curwid;
  459. Xstatic char FileName[80];
  460. Xstatic char line[80];
  461. Xstatic PLINT xwidth, ywidth, xsubw, ysubw;
  462. Xstatic PLINT vxwidth, vywidth;
  463. Xstatic PLFLT xdotspi, ydotspi;
  464. X
  465. Xvoid iffsetup(xdpi, ydpi, xwid, ywid)
  466. XPLINT xwid, ywid;
  467. XPLFLT xdpi, ydpi;
  468. X{
  469. X   xdotspi = xdpi;
  470. X   ydotspi = ydpi;
  471. X   xwidth = xwid;
  472. X   ywidth = ywid;
  473. X   setup = 1;
  474. X}
  475. X
  476. Xvoid iffselect(ori, name)
  477. XPLINT ori;
  478. Xchar *name;
  479. X{
  480. X   orient = ori;
  481. X   strncpy(FileName,name,sizeof(FileName)-1);
  482. X   FileName[sizeof(FileName)-1] = '\0';
  483. X   select = 1;
  484. X}
  485. X
  486. Xstatic PLINT getint(s)
  487. Xchar *s;
  488. X{
  489. X   PLINT m;
  490. X
  491. X   while(1) {
  492. X      printf(s);
  493. X      fgets(line,sizeof(line),stdin);
  494. X      if(sscanf(line,"%d",&m) == 1)
  495. X         return(m);
  496. X      printf("No value or value out of range; please try again\n");
  497. X   }
  498. X}
  499. X
  500. Xstatic PLFLT getflt(s)
  501. Xchar *s;
  502. X{
  503. X   PLFLT m;
  504. X
  505. X   while(1) {
  506. X      printf(s);
  507. X      fgets(line,sizeof(line),stdin);
  508. X      if(sscanf(line,"%f",&m) == 1)
  509. X         return(m);
  510. X      printf("No value or value out of range; please try again\n");
  511. X   }
  512. X}
  513. X
  514. Xvoid iffopenfile()
  515. X{
  516. X   for(;;) {
  517. X      if(!select) {
  518. X         printf("Enter graphics file name. ");
  519. X         fgets(line,sizeof(line),stdin);
  520. X         if(sscanf(line,"%s",FileName)!=1)
  521. X            continue;
  522. X      }
  523. X
  524. X      if (!(OutFile = fopen(FileName,"w"))) {
  525. X         fprintf(stderr,"Can't open %s.\n",FileName);
  526. X         select = 0;
  527. X      }
  528. X      else
  529. X         break;
  530. X   }
  531. X   select = 0;
  532. X}
  533. X
  534. Xvoid iffinit()
  535. X{
  536. X   int mapinit();
  537. X
  538. X   if(!setup) {
  539. X      xdotspi = getflt("Enter desired horizontal IFF resolution (dpi): ");
  540. X      ydotspi = getflt("Enter desired vertical   IFF resolution (dpi): ");
  541. X      xwidth  = getint("Enter desired horizontal IFF size in pixels  : ");
  542. X      ywidth  = getint("Enter desired vertical   IFF size in pixels  : ");
  543. X   }
  544. X   setup = 0;
  545. X
  546. X   vxwidth = xwidth*25;
  547. X   vywidth = ywidth*25;
  548. X
  549. X   if(!select)
  550. X      orient = getint("Landscape or portrait orientation? (0 or 1) ");
  551. X
  552. X   if(orient) {
  553. X      setpxl((PLFLT)(ydotspi*25/25.4), (PLFLT)(xdotspi*25/25.4));
  554. X      setphy(0,vywidth,0,vxwidth);
  555. X   }
  556. X   else {
  557. X      setpxl((PLFLT)(xdotspi*25./25.4), (PLFLT)(ydotspi*25/25.4));
  558. X      setphy(0,vxwidth,0,vywidth);
  559. X   }
  560. X
  561. X   xsubw = xwidth - 2;
  562. X   ysubw = ywidth - 2;
  563. X
  564. X   scol(1);   /* set pen color (ignored for this driver) */
  565. X   swid(1);   /* set default pen width */
  566. X   smod(0);   /* set mode (not an interactive device) */
  567. X
  568. X   /* Allocate bitmap and initialize for line drawing */
  569. X   if(mapinit(xwidth, ywidth)) {
  570. X      plexit("");
  571. X   }
  572. X}
  573. X
  574. X/* Set IFF to test mode */
  575. Xvoid ifftext()
  576. X{
  577. X  /* do nothing here */
  578. X}
  579. X
  580. X/* Set IFF to graphics mode */
  581. Xvoid iffgraph()
  582. X{
  583. X  /* Do nothing here */
  584. X}
  585. X
  586. X/* Print out page */
  587. Xvoid iffclear()
  588. X{
  589. X  void iffwritefile();
  590. X
  591. X  iffwritefile((PLINT)xdotspi,(PLINT)ydotspi,OutFile);
  592. X  fclose(OutFile) ;
  593. X}
  594. X
  595. Xvoid iffpage()
  596. X{
  597. X   void mapclear();
  598. X
  599. X   mapclear();
  600. X   iffopenfile();
  601. X}
  602. X
  603. Xvoid iffwidth(width)
  604. XPLINT width;
  605. X{
  606. X   if(width < 1)
  607. X      curwid = 1;
  608. X   else if(width > 3)
  609. X      curwid = 3;
  610. X   else
  611. X      curwid = width;
  612. X}
  613. X
  614. X/* Change color */
  615. Xvoid iffcolor(colour)
  616. XPLINT colour;
  617. X{
  618. X}
  619. X
  620. Xvoid iffline(x1,y1,x2,y2)
  621. XPLINT x1, y1, x2, y2;
  622. X{
  623. X   long xn1, yn1, xn2, yn2;
  624. X   void mapline();
  625. X
  626. X   if(orient) {
  627. X      xn1 = (x1*ysubw)/vywidth;
  628. X      yn1 = (y1*xsubw)/vxwidth;
  629. X      xn2 = (x2*ysubw)/vywidth;
  630. X      yn2 = (y2*xsubw)/vxwidth;
  631. X      switch(curwid) {
  632. X         case 3:
  633. X            mapline(yn1,xn1,yn2,xn2);
  634. X         case 2:
  635. X            mapline(yn1+2,xn1+2,yn2+2,xn2+2);
  636. X         case 1:
  637. X         default:
  638. X            mapline(yn1+1,xn1+1,yn2+1,xn2+1);
  639. X      }
  640. X   }
  641. X   else {
  642. X      xn1 = (x1*xsubw)/vxwidth;
  643. X      yn1 = (y1*ysubw)/vywidth;
  644. X      xn2 = (x2*xsubw)/vxwidth;
  645. X      yn2 = (y2*ysubw)/vywidth;
  646. X      switch(curwid) {
  647. X         case 3:
  648. X            mapline(xn1,ysubw-yn1,xn2,ysubw-yn2);
  649. X         case 2:
  650. X            mapline(xn1+2,ysubw-yn1+2,xn2+2,ysubw-yn2+2);
  651. X         case 1:
  652. X         default:
  653. X            mapline(xn1+1,ysubw-yn1+1,xn2+1,ysubw-yn2+1);
  654. X      }
  655. X   }
  656. X}
  657. X
  658. X/* Reset printer and close file */
  659. Xvoid ifftidy()
  660. X{
  661. X  void iffwritefile(), mapfree();
  662. X
  663. X  iffwritefile((PLINT)xdotspi,(PLINT)ydotspi,OutFile);
  664. X  fclose(OutFile) ;
  665. X  mapfree();
  666. X}
  667. X
  668. END_OF_FILE
  669. if test 4271 -ne `wc -c <'drivers/iff.c'`; then
  670.     echo shar: \"'drivers/iff.c'\" unpacked with wrong size!
  671. fi
  672. # end of 'drivers/iff.c'
  673. fi
  674. if test -f 'src/global.c' -a "${1}" != "-c" ; then 
  675.   echo shar: Will not clobber existing file \"'src/global.c'\"
  676. else
  677. echo shar: Extracting \"'src/global.c'\" \(6662 characters\)
  678. sed "s/^X//" >'src/global.c' <<'END_OF_FILE'
  679. X/* Sets and gets global variables */
  680. X
  681. X#include "plplot.h"
  682. X#include "declare.h"
  683. X
  684. Xvoid glev(n)
  685. XPLINT *n;
  686. X{
  687. X      *n = level;
  688. X}
  689. X
  690. Xvoid slev(n)
  691. XPLINT n;
  692. X{
  693. X      level = n;
  694. X}
  695. X
  696. Xvoid gbase(x,y,xc,yc)
  697. XPLFLT *x,*y,*xc,*yc;
  698. X{
  699. X      *x = base3x;
  700. X      *y = base3y;
  701. X      *xc = basecx;
  702. X      *yc = basecy;
  703. X}
  704. X
  705. Xvoid sbase(x,y,xc,yc)
  706. XPLFLT x,y,xc,yc;
  707. X{
  708. X      base3x = x;
  709. X      base3y = y;
  710. X      basecx = xc;
  711. X      basecy = yc;
  712. X}
  713. X
  714. Xvoid gnms(n)
  715. XPLINT *n;
  716. X{
  717. X      *n = nms;
  718. X}
  719. X
  720. Xvoid snms(n)
  721. XPLINT n;
  722. X{
  723. X      nms = n;
  724. X}
  725. X
  726. Xvoid gdev(dev,term,gra)
  727. XPLINT *dev,*term,*gra;
  728. X{
  729. X      *dev = device;
  730. X      *term = termin;
  731. X      *gra = graphx;
  732. X}
  733. X
  734. Xvoid sdev(dev,term,gra)
  735. XPLINT dev,term,gra;
  736. X{
  737. X      device = dev;
  738. X      termin = term;
  739. X      graphx = gra;
  740. X}
  741. X
  742. Xvoid smod(term)
  743. XPLINT term;
  744. X{
  745. X      termin = term;
  746. X}
  747. X
  748. Xvoid gcurr(ix,iy)
  749. XPLINT *ix,*iy;
  750. X{
  751. X      *ix = currx;
  752. X      *iy = curry;
  753. X}
  754. X
  755. Xvoid scurr(ix,iy)
  756. XPLINT ix,iy;
  757. X{
  758. X      currx = ix;
  759. X      curry = iy;
  760. X}
  761. X
  762. Xvoid gdom(xmin,xmax,ymin,ymax)
  763. XPLFLT *xmin,*xmax,*ymin,*ymax;
  764. X{
  765. X      *xmin = domxmi;
  766. X      *xmax = domxma;
  767. X      *ymin = domymi;
  768. X      *ymax = domyma;
  769. X}
  770. X
  771. Xvoid sdom(xmin,xmax,ymin,ymax)
  772. XPLFLT xmin,xmax,ymin,ymax;
  773. X{
  774. X      domxmi = xmin;
  775. X      domxma = xmax;
  776. X      domymi = ymin;
  777. X      domyma = ymax;
  778. X}
  779. X
  780. Xvoid grange(zscl,zmin,zmax)
  781. XPLFLT *zscl,*zmin,*zmax;
  782. X{
  783. X      *zscl = zzscl;
  784. X      *zmin = ranmi;
  785. X      *zmax = ranma;
  786. X}
  787. X
  788. Xvoid srange(zscl,zmin,zmax)
  789. XPLFLT zscl,zmin,zmax;
  790. X{
  791. X      zzscl = zscl;
  792. X      ranmi = zmin;
  793. X      ranma = zmax;
  794. X}
  795. X
  796. Xvoid gw3wc(dxx,dxy,dyx,dyy,dyz)
  797. XPLFLT *dxx,*dxy,*dyx,*dyy,*dyz;
  798. X{
  799. X      *dxx = cxx;
  800. X      *dxy = cxy;
  801. X      *dyx = cyx;
  802. X      *dyy = cyy;
  803. X      *dyz = cyz;
  804. X}
  805. X
  806. Xvoid sw3wc(dxx,dxy,dyx,dyy,dyz)
  807. XPLFLT dxx,dxy,dyx,dyy,dyz;
  808. X{
  809. X      cxx = dxx;
  810. X      cxy = dxy;
  811. X      cyx = dyx;
  812. X      cyy = dyy;
  813. X      cyz = dyz;
  814. X}
  815. X
  816. Xvoid gvpp(ixmin,ixmax,iymin,iymax)
  817. XPLINT *ixmin,*ixmax,*iymin,*iymax;
  818. X{
  819. X      *ixmin = vppxmi;
  820. X      *ixmax = vppxma;
  821. X      *iymin = vppymi;
  822. X      *iymax = vppyma;
  823. X}
  824. X
  825. Xvoid svpp(ixmin,ixmax,iymin,iymax)
  826. XPLINT ixmin,ixmax,iymin,iymax;
  827. X{
  828. X      vppxmi = ixmin;
  829. X      vppxma = ixmax;
  830. X      vppymi = iymin;
  831. X      vppyma = iymax;
  832. X}
  833. X
  834. Xvoid gspp(ixmin,ixmax,iymin,iymax)
  835. XPLINT *ixmin,*ixmax,*iymin,*iymax;
  836. X{
  837. X      *ixmin = sppxmi;
  838. X      *ixmax = sppxma;
  839. X      *iymin = sppymi;
  840. X      *iymax = sppyma;
  841. X}
  842. X
  843. Xvoid sspp(ixmin,ixmax,iymin,iymax)
  844. XPLINT ixmin,ixmax,iymin,iymax;
  845. X{
  846. X      sppxmi = ixmin;
  847. X      sppxma = ixmax;
  848. X      sppymi = iymin;
  849. X      sppyma = iymax;
  850. X}
  851. X
  852. Xvoid gclp(ixmin,ixmax,iymin,iymax)
  853. XPLINT *ixmin,*ixmax,*iymin,*iymax;
  854. X{
  855. X      *ixmin = clpxmi;
  856. X      *ixmax = clpxma;
  857. X      *iymin = clpymi;
  858. X      *iymax = clpyma;
  859. X}
  860. X
  861. Xvoid sclp(ixmin,ixmax,iymin,iymax)
  862. XPLINT ixmin,ixmax,iymin,iymax;
  863. X{
  864. X      clpxmi = ixmin;
  865. X      clpxma = ixmax;
  866. X      clpymi = iymin;
  867. X      clpyma = iymax;
  868. X}
  869. X
  870. Xvoid gphy(ixmin,ixmax,iymin,iymax)
  871. XPLINT *ixmin,*ixmax,*iymin,*iymax;
  872. X{
  873. X      *ixmin = phyxmi;
  874. X      *ixmax = phyxma;
  875. X      *iymin = phyymi;
  876. X      *iymax = phyyma;
  877. X}
  878. X
  879. Xvoid sphy(ixmin,ixmax,iymin,iymax)
  880. XPLINT ixmin,ixmax,iymin,iymax;
  881. X{
  882. X      phyxmi = ixmin;
  883. X      phyxma = ixmax;
  884. X      phyymi = iymin;
  885. X      phyyma = iymax;
  886. X}
  887. X
  888. Xvoid gsub(nx,ny,cs)
  889. XPLINT *nx,*ny,*cs;
  890. X{
  891. X      *nx = nsubx;
  892. X      *ny = nsuby;
  893. X      *cs = cursub;
  894. X}
  895. X
  896. Xvoid ssub(nx,ny,cs)
  897. XPLINT nx,ny,cs;
  898. X{
  899. X      nsubx = nx;
  900. X      nsuby = ny;
  901. X      cursub = cs;
  902. X}
  903. X
  904. Xvoid gumpix(ix,iy)
  905. XPLINT *ix,*iy;
  906. X{
  907. X      *ix = umx;
  908. X      *iy = umy;
  909. X}
  910. X
  911. Xvoid sumpix(ix,iy)
  912. XPLINT ix,iy;
  913. X{
  914. X      umx = ix;
  915. X      umy = iy;
  916. X}
  917. X
  918. Xvoid gatt(ifnt,icol)
  919. XPLINT *ifnt,*icol;
  920. X{
  921. X      *ifnt = font;
  922. X      *icol = colour;
  923. X}
  924. X
  925. Xvoid satt(ifnt,icol)
  926. XPLINT ifnt,icol;
  927. X{
  928. X      font = ifnt;
  929. X      colour = icol;
  930. X}
  931. X
  932. Xvoid gcol(icol)
  933. XPLINT *icol;
  934. X{
  935. X      *icol = colour;
  936. X}
  937. X
  938. Xvoid scol(icol)
  939. XPLINT icol;
  940. X{
  941. X      colour = icol;
  942. X}
  943. X
  944. Xvoid gwid(pwid)
  945. XPLINT *pwid;
  946. X{
  947. X      *pwid = width;
  948. X}
  949. X
  950. Xvoid swid(pwid)
  951. XPLINT pwid;
  952. X{
  953. X      width = pwid;
  954. X}
  955. X
  956. Xvoid gspd(xmin,xmax,ymin,ymax)
  957. XPLFLT *xmin,*xmax,*ymin,*ymax;
  958. X{
  959. X      *xmin = spdxmi;
  960. X      *xmax = spdxma;
  961. X      *ymin = spdymi;
  962. X      *ymax = spdyma;
  963. X}
  964. X
  965. Xvoid sspd(xmin,xmax,ymin,ymax)
  966. XPLFLT xmin,xmax,ymin,ymax;
  967. X{
  968. X      spdxmi = xmin;
  969. X      spdxma = xmax;
  970. X      spdymi = ymin;
  971. X      spdyma = ymax;
  972. X}
  973. X
  974. Xvoid gvpd(xmin,xmax,ymin,ymax)
  975. XPLFLT *xmin,*xmax,*ymin,*ymax;
  976. X{
  977. X      *xmin = vpdxmi;
  978. X      *xmax = vpdxma;
  979. X      *ymin = vpdymi;
  980. X      *ymax = vpdyma;
  981. X}
  982. X
  983. Xvoid svpd(xmin,xmax,ymin,ymax)
  984. XPLFLT xmin,xmax,ymin,ymax;
  985. X{
  986. X      vpdxmi = xmin;
  987. X      vpdxma = xmax;
  988. X      vpdymi = ymin;
  989. X      vpdyma = ymax;
  990. X}
  991. X
  992. Xvoid gvpw(xmin,xmax,ymin,ymax)
  993. XPLFLT *xmin,*xmax,*ymin,*ymax;
  994. X{
  995. X      *xmin = vpwxmi;
  996. X      *xmax = vpwxma;
  997. X      *ymin = vpwymi;
  998. X      *ymax = vpwyma;
  999. X}
  1000. X
  1001. Xvoid svpw(xmin,xmax,ymin,ymax)
  1002. XPLFLT xmin,xmax,ymin,ymax;
  1003. X{
  1004. X      vpwxmi = xmin;
  1005. X      vpwxma = xmax;
  1006. X      vpwymi = ymin;
  1007. X      vpwyma = ymax;
  1008. X}
  1009. X
  1010. Xvoid gpixmm(x,y)
  1011. XPLFLT *x,*y;
  1012. X{
  1013. X      *x = xpmm;
  1014. X      *y = ypmm;
  1015. X}
  1016. X
  1017. Xvoid spixmm(x,y)
  1018. XPLFLT x,y;
  1019. X{
  1020. X      xpmm = x;
  1021. X      ypmm = y;
  1022. X}
  1023. X
  1024. Xvoid gwp(xscl,xoff,yscl,yoff)
  1025. XPLFLT *xscl,*xoff,*yscl,*yoff;
  1026. X{
  1027. X      *xscl = wpxscl;
  1028. X      *xoff = wpxoff;
  1029. X      *yscl = wpyscl;
  1030. X      *yoff = wpyoff;
  1031. X}
  1032. X
  1033. Xvoid swp(xscl,xoff,yscl,yoff)
  1034. XPLFLT xscl,xoff,yscl,yoff;
  1035. X{
  1036. X      wpxscl = xscl;
  1037. X      wpxoff = xoff;
  1038. X      wpyscl = yscl;
  1039. X      wpyoff = yoff;
  1040. X}
  1041. X
  1042. Xvoid gwm(xscl,xoff,yscl,yoff)
  1043. XPLFLT *xscl,*xoff,*yscl,*yoff;
  1044. X{
  1045. X      *xscl = wmxscl;
  1046. X      *xoff = wmxoff;
  1047. X      *yscl = wmyscl;
  1048. X      *yoff = wmyoff;
  1049. X}
  1050. X
  1051. Xvoid swm(xscl,xoff,yscl,yoff)
  1052. XPLFLT xscl,xoff,yscl,yoff;
  1053. X{
  1054. X      wmxscl = xscl;
  1055. X      wmxoff = xoff;
  1056. X      wmyscl = yscl;
  1057. X      wmyoff = yoff;
  1058. X}
  1059. X
  1060. Xvoid gdp(xscl,xoff,yscl,yoff)
  1061. XPLFLT *xscl,*xoff,*yscl,*yoff;
  1062. X{
  1063. X      *xscl = dpxscl;
  1064. X      *xoff = dpxoff;
  1065. X      *yscl = dpyscl;
  1066. X      *yoff = dpyoff;
  1067. X}
  1068. X
  1069. Xvoid sdp(xscl,xoff,yscl,yoff)
  1070. XPLFLT xscl,xoff,yscl,yoff;
  1071. X{
  1072. X      dpxscl = xscl;
  1073. X      dpxoff = xoff;
  1074. X      dpyscl = yscl;
  1075. X      dpyoff = yoff;
  1076. X}
  1077. X
  1078. Xvoid gmp(xscl,xoff,yscl,yoff)
  1079. XPLFLT *xscl,*xoff,*yscl,*yoff;
  1080. X{
  1081. X      *xscl = mpxscl;
  1082. X      *xoff = mpxoff;
  1083. X      *yscl = mpyscl;
  1084. X      *yoff = mpyoff;
  1085. X}
  1086. X
  1087. Xvoid smp(xscl,xoff,yscl,yoff)
  1088. XPLFLT xscl,xoff,yscl,yoff;
  1089. X{
  1090. X      mpxscl = xscl;
  1091. X      mpxoff = xoff;
  1092. X      mpyscl = yscl;
  1093. X      mpyoff = yoff;
  1094. X}
  1095. X
  1096. Xvoid gchr(def,ht)
  1097. XPLFLT *def,*ht;
  1098. X{
  1099. X      *def = chrdef;
  1100. X      *ht = chrht;
  1101. X}
  1102. X
  1103. Xvoid schr(def,ht)
  1104. XPLFLT def,ht;
  1105. X{
  1106. X      chrdef = def;
  1107. X      chrht = ht;
  1108. X}
  1109. X
  1110. Xvoid gsym(def,ht)
  1111. XPLFLT *def,*ht;
  1112. X{
  1113. X      *def = symdef;
  1114. X      *ht = symht;
  1115. X}
  1116. X
  1117. Xvoid ssym(def,ht)
  1118. XPLFLT def,ht;
  1119. X{
  1120. X      symdef = def;
  1121. X      symht = ht;
  1122. X}
  1123. X
  1124. Xvoid gmaj(def,ht)
  1125. XPLFLT *def,*ht;
  1126. X{
  1127. X      *def = majdef;
  1128. X      *ht = majht;
  1129. X}
  1130. X
  1131. Xvoid smaj(def,ht)
  1132. XPLFLT def,ht;
  1133. X{
  1134. X      majdef = def;
  1135. X      majht = ht;
  1136. X}
  1137. X
  1138. Xvoid gmin(def,ht)
  1139. XPLFLT *def,*ht;
  1140. X{
  1141. X      *def = mindef;
  1142. X      *ht = minht;
  1143. X}
  1144. X
  1145. Xvoid smin(def,ht)
  1146. XPLFLT def,ht;
  1147. X{
  1148. X      mindef = def;
  1149. X      minht = ht;
  1150. X}
  1151. X
  1152. END_OF_FILE
  1153. if test 6662 -ne `wc -c <'src/global.c'`; then
  1154.     echo shar: \"'src/global.c'\" unpacked with wrong size!
  1155. fi
  1156. # end of 'src/global.c'
  1157. fi
  1158. if test -f 'src/plcntr.c' -a "${1}" != "-c" ; then 
  1159.   echo shar: Will not clobber existing file \"'src/plcntr.c'\"
  1160. else
  1161. echo shar: Extracting \"'src/plcntr.c'\" \(5746 characters\)
  1162. sed "s/^X//" >'src/plcntr.c' <<'END_OF_FILE'
  1163. X/* points is a pointer to a 2d array of nx by ny points. */
  1164. X/* iscan has nx elements. ixstor and iystor each have nstor elements. */
  1165. X
  1166. X#include "plplot.h"
  1167. X
  1168. Xvoid plcntr(points,nx,ny,kx,lx,ky,ly,zlev,iscan,ixstor,iystor,nstor,pltr)
  1169. XPLINT nx, ny, ky, ly, kx, lx, nstor;
  1170. XPLFLT zlev, *points;
  1171. XPLINT *iscan, *ixstor, *iystor;
  1172. Xvoid (*pltr)();
  1173. X{
  1174. X      PLINT kcol, krow, kstor, kscan, iwbeg, ixbeg, iybeg, izbeg;
  1175. X      PLINT iboun, iw, ix, iy, iz, ifirst, istep, ixgo, iygo;
  1176. X      PLINT l, ixg, iyg, ia, ib, ixt, iyt, jstor, next;
  1177. X      PLFLT dist, dx, dy, xnew, ynew, x, y;
  1178. X      PLFLT xlas=0., ylas=0., tpx, tpy, xt, yt;
  1179. X
  1180. X      /* Initialize memory pointers */
  1181. X
  1182. X      kstor = 0;
  1183. X      kscan = 0;
  1184. X
  1185. X      for (krow=ky; krow<=ly; krow++) {
  1186. X        for (kcol=kx+1; kcol <= lx; kcol++)  {
  1187. X
  1188. X          /* Check if a contour has been crossed */
  1189. X
  1190. X          x = *(points + (kcol-2)*ny + krow-1);
  1191. X          y = *(points + (kcol-1)*ny + krow-1);
  1192. X          if (x < zlev && y >= zlev) {
  1193. X            ixbeg = kcol-1;
  1194. X            iwbeg = kcol;
  1195. X          }
  1196. X          else if (y < zlev && x >= zlev) {
  1197. X            ixbeg = kcol;
  1198. X            iwbeg = kcol-1;
  1199. X          }
  1200. X          else
  1201. X            goto lab70;
  1202. X
  1203. X          iybeg = krow;
  1204. X          izbeg = krow;
  1205. X
  1206. X          /* Yes, a contour has been crossed. Check to see if it */
  1207. X          /* is a new one. */
  1208. X
  1209. X          for(l=0;l<kscan;l++)
  1210. X            if (ixbeg == iscan[l]) goto lab70;
  1211. X
  1212. X          /* Here is the section which follows and draws a contour */
  1213. X
  1214. X          for (iboun=1; iboun>= -1; iboun -= 2) {
  1215. X
  1216. X            /* Set up starting point and initial search directions */
  1217. X
  1218. X            ix = ixbeg;
  1219. X            iy = iybeg;
  1220. X            iw = iwbeg;
  1221. X            iz = izbeg;
  1222. X            ifirst = 1;
  1223. X            istep = 0;
  1224. X            ixgo = iw - ix;
  1225. X            iygo = iz - iy;
  1226. X
  1227. Xlab20:
  1228. X              plccal(points,nx,ny,zlev,ix,iy,ixgo,iygo,&dist);
  1229. X              dx = dist * ixgo;
  1230. X              dy = dist * iygo;
  1231. X              xnew = ix+dx;
  1232. X              ynew = iy+dy;
  1233. X
  1234. X             /* Has a step occured in search? */
  1235. X
  1236. X              if (istep != 0) {
  1237. X                if (ixgo*iygo == 0) {
  1238. X
  1239. X                  /* This was a diagonal step, so interpolate missed */
  1240. X                  /* point, rotating 45 degrees to get it */
  1241. X
  1242. X                  ixg = ixgo;
  1243. X                  iyg = iygo;
  1244. X                  plr45(&ixg,&iyg,iboun);
  1245. X                  ia = iw-ixg;
  1246. X                  ib = iz-iyg;
  1247. X                  plccal(points,nx,ny,zlev,ia,ib,ixg,iyg,&dist);
  1248. X                  (*pltr)(xlas-1,ylas-1,&tpx,&tpy);
  1249. X                  drawor(tpx,tpy);
  1250. X                  dx = dist*ixg;
  1251. X                  dy = dist*iyg;
  1252. X                  xlas = ia+dx;
  1253. X                  ylas = ib+dy;
  1254. X                }
  1255. X                else {
  1256. X                  if (dist > 0.5) {
  1257. X                    xt = xlas;
  1258. X                    xlas = xnew;
  1259. X                    xnew = xt;
  1260. X                    yt = ylas;
  1261. X                    ylas = ynew;
  1262. X                    ynew = yt;
  1263. X                  }
  1264. X                }
  1265. X              }
  1266. X              if (ifirst != 1) {
  1267. X                (*pltr)(xlas-1,ylas-1,&tpx,&tpy);
  1268. X                drawor(tpx,tpy);
  1269. X              }
  1270. X              else {
  1271. X                (*pltr)(xnew-1,ynew-1,&tpx,&tpy);
  1272. X                movwor(tpx,tpy);
  1273. X              }
  1274. X              xlas = xnew;
  1275. X              ylas = ynew;
  1276. X
  1277. X              /* Check if the contour is closed */
  1278. X
  1279. X              if (ifirst != 1 && ix == ixbeg && iy == iybeg
  1280. X                  && iw == iwbeg && iz == izbeg) {
  1281. X                (*pltr)(xlas-1,ylas-1,&tpx,&tpy);
  1282. X                drawor(tpx,tpy);
  1283. X                goto lab70;
  1284. X              }
  1285. X              ifirst = 0;
  1286. X
  1287. X              /* Now the rotation */
  1288. X
  1289. X              istep = 0;
  1290. X              plr45(&ixgo,&iygo,iboun);
  1291. X              iw = ix+ixgo;
  1292. X              iz = iy+iygo;
  1293. X
  1294. X              /* Check if out of bounds */
  1295. X
  1296. X              if (iw<kx || iw>lx || iz<ky || iz>ly) goto  lab50;
  1297. X
  1298. X              /* Has contact been lost with the contour? */
  1299. X
  1300. X              if (*(points+(iw-1)*ny+iz-1) < zlev) {
  1301. X
  1302. X                /* Yes, lost contact => step to new centre */
  1303. X
  1304. X                istep = 1;
  1305. X                ix = iw;
  1306. X                iy = iz;
  1307. X                plr135(&ixgo,&iygo,iboun);
  1308. X                iw = ix+ixgo;
  1309. X                iz = iy+iygo;
  1310. X
  1311. X                /* And do the contour memory */
  1312. X
  1313. X                if (iy == krow) {
  1314. X                  kscan = kscan+1;
  1315. X                  iscan[kscan-1] = ix;
  1316. X                }
  1317. X                else if (iy>krow) {
  1318. X                  kstor = kstor+1;
  1319. X                  if (kstor>nstor) {
  1320. X                    plexit("Heap exhausted in plcont.");
  1321. X                  }
  1322. X                  ixstor[kstor-1] = ix;
  1323. X                  iystor[kstor-1] = iy;
  1324. X                }
  1325. X              }
  1326. X            goto lab20;
  1327. Xlab50:
  1328. X            /* Reach here only if boundary encountered - Draw last bit */
  1329. X
  1330. X            (*pltr)(xnew-1,ynew-1,&tpx,&tpy);
  1331. X            drawor(tpx,tpy);
  1332. X          }
  1333. Xlab70:
  1334. X          ;    /* Null statement to carry label */
  1335. X        }
  1336. X
  1337. X        /* Search of row complete - set up memory of next row in iscan and */
  1338. X        /* edit ixstor and iystor */
  1339. X
  1340. X        if (krow<ny) {
  1341. X          jstor = 0;
  1342. X          kscan = 0;
  1343. X          next = krow+1;
  1344. X          for (l=1; l<=kstor; l++) {
  1345. X            ixt = ixstor[l-1];
  1346. X            iyt = iystor[l-1];
  1347. X
  1348. X            /* Memory of next row into iscan */
  1349. X
  1350. X            if (iyt == next) {
  1351. X              kscan = kscan+1;
  1352. X              iscan[kscan-1] = ixt;
  1353. X
  1354. X            /* Retain memory of rows to come, and forget rest */
  1355. X
  1356. X            }
  1357. X            else if (iyt>next) {
  1358. X              jstor = jstor+1;
  1359. X              ixstor[jstor-1] = ixt;
  1360. X              iystor[jstor-1] = iyt;
  1361. X            }
  1362. X          }
  1363. X          kstor = jstor;
  1364. X        }
  1365. X      }
  1366. X}
  1367. END_OF_FILE
  1368. if test 5746 -ne `wc -c <'src/plcntr.c'`; then
  1369.     echo shar: \"'src/plcntr.c'\" unpacked with wrong size!
  1370. fi
  1371. # end of 'src/plcntr.c'
  1372. fi
  1373. if test -f 'src/plfill.c' -a "${1}" != "-c" ; then 
  1374.   echo shar: Will not clobber existing file \"'src/plfill.c'\"
  1375. else
  1376. echo shar: Extracting \"'src/plfill.c'\" \(5226 characters\)
  1377. sed "s/^X//" >'src/plfill.c' <<'END_OF_FILE'
  1378. X#include "plplot.h"
  1379. X#include "declare.h"
  1380. X#include <math.h>
  1381. X#ifdef PLSTDC
  1382. X#include <stdlib.h>
  1383. X#else
  1384. Xextern char *malloc();
  1385. Xextern char *realloc();
  1386. Xextern void free();
  1387. X#endif
  1388. X
  1389. X#define betw(ix,ia,ib)  (((ix)<=(ia)&&(ix)>=(ib)) || ((ix)>=(ia)&&(ix)<=(ib)))
  1390. X#define ssqr(a,b)       sqrt((a)*(a)+(b)*(b))
  1391. X#define sign(a)         ((a)<0 ? -1 : 1)
  1392. X#define DTOR            0.0174533
  1393. X#define BINC            50
  1394. X
  1395. Xstruct point {
  1396. X   short x, y;
  1397. X};
  1398. X
  1399. Xstatic short bufferleng, buffersize, *buffer;
  1400. X
  1401. Xvoid plfill(n,x,y)
  1402. XPLINT n;
  1403. XPLFLT *x, *y;
  1404. X{
  1405. X   PLINT i,level;
  1406. X   PLINT xmin, ymin, x1, y1, x2, y2, x3, y3;
  1407. X   PLINT k, dinc;
  1408. X   PLFLT ci, si, thetd;
  1409. X   short swap;
  1410. X   int compare();
  1411. X   void buildlist(), qsort(), tran();
  1412. X
  1413. X   glev(&level);
  1414. X   if (level<3) plexit("Please set up window before calling plfill.");
  1415. X   if (n<3) plexit("Not enough points in plfill object!");
  1416. X
  1417. X   buffersize = 2*BINC;
  1418. X   buffer = (short *)malloc(buffersize*sizeof(short));
  1419. X   if(!buffer)
  1420. X      plexit("Out of memory in plfill.");
  1421. X
  1422. X   for(k=0; k<nps; k++) {
  1423. X      bufferleng = 0;
  1424. X
  1425. X      if(abs(inclin[k]) <= 450) {
  1426. X         thetd = atan(tan(DTOR*inclin[k]/10.)*ypmm/xpmm);
  1427. X         swap = 0;
  1428. X      }
  1429. X      else {
  1430. X         thetd = atan(tan(DTOR*sign(inclin[k])*
  1431. X                          (abs(inclin[k])-900)/10.)*xpmm/ypmm);
  1432. X         swap = 1;
  1433. X      }
  1434. X      ci = cos(thetd);
  1435. X      si = sin(thetd);
  1436. X      if(swap)
  1437. X         dinc = delta[k]*ssqr(xpmm*abs(ci),ypmm*abs(si))/1000.;
  1438. X      else
  1439. X         dinc = delta[k]*ssqr(ypmm*abs(ci),xpmm*abs(si))/1000.;
  1440. X
  1441. X      xmin = wcpcx(x[0]); ymin = wcpcy(y[0]);
  1442. X      for(i=1; i<n; i++) {
  1443. X         xmin = min(xmin,wcpcx(x[i]));
  1444. X         ymin = min(ymin,wcpcy(y[i]));
  1445. X      }
  1446. X
  1447. X      x1 = wcpcx(x[0]) - xmin;
  1448. X      y1 = wcpcy(y[0]) - ymin;
  1449. X      tran(&x1,&y1,ci,si);
  1450. X      x2 = wcpcx(x[1]) - xmin;
  1451. X      y2 = wcpcy(y[1]) - ymin;
  1452. X      tran(&x2,&y2,ci,si);
  1453. X      for(i=2; i<n; i++) {
  1454. X         x3 = wcpcx(x[i]) - xmin;
  1455. X         y3 = wcpcy(y[i]) - ymin;
  1456. X         tran(&x3,&y3,ci,si);
  1457. X         if(swap)
  1458. X            buildlist(y1,x1,y2,x2,y3,x3,dinc);
  1459. X         else
  1460. X            buildlist(x1,y1,x2,y2,x3,y3,dinc);
  1461. X         x1 = x2; y1 = y2;
  1462. X         x2 = x3; y2 = y3;
  1463. X      }
  1464. X      x3 = wcpcx(x[0]) - xmin;
  1465. X      y3 = wcpcy(y[0]) - ymin;
  1466. X      tran(&x3,&y3,ci,si);
  1467. X      if(swap)
  1468. X         buildlist(y1,x1,y2,x2,y3,x3,dinc);
  1469. X      else
  1470. X         buildlist(x1,y1,x2,y2,x3,y3,dinc);
  1471. X
  1472. X      x1 = x2; y1 = y2;
  1473. X      x2 = x3; y2 = y3;
  1474. X      x3 = wcpcx(x[1]) - xmin;
  1475. X      y3 = wcpcy(y[1]) - ymin;
  1476. X      tran(&x3,&y3,ci,si);
  1477. X      if(swap)
  1478. X         buildlist(y1,x1,y2,x2,y3,x3,dinc);
  1479. X      else
  1480. X         buildlist(x1,y1,x2,y2,x3,y3,dinc);
  1481. X
  1482. X      /* Sort list by y then x */
  1483. X      qsort((char *)buffer,bufferleng/2,sizeof(struct point),compare);
  1484. X
  1485. X      /* OK, now do the hatching */
  1486. X      i = 0;
  1487. X      while(i<bufferleng) {
  1488. X         if(swap) {
  1489. X            x1 = buffer[i+1]; y1 = buffer[i];
  1490. X         }
  1491. X         else {
  1492. X            x1 = buffer[i]; y1 = buffer[i+1];
  1493. X         }
  1494. X         i += 2;
  1495. X         x2 = x1; y2 = y1;
  1496. X         tran(&x1,&y1,ci,-si);
  1497. X         movphy(x1+xmin,y1+ymin);
  1498. X         if(swap) {
  1499. X            x1 = buffer[i+1]; y1 = buffer[i];
  1500. X         }
  1501. X         else {
  1502. X            x1 = buffer[i]; y1 = buffer[i+1];
  1503. X         }
  1504. X         i += 2;
  1505. X         if((swap && x2 != x1) || (!swap && y2 != y1))
  1506. X            continue;          /* Uh oh we're lost */
  1507. X         tran(&x1,&y1,ci,-si);
  1508. X         draphy(x1+xmin,y1+ymin);
  1509. X      }
  1510. X
  1511. X   }
  1512. X   free((VOID *)buffer);
  1513. X}
  1514. X
  1515. Xvoid tran(a,b,c,d)
  1516. XPLINT *a, *b;
  1517. XPLFLT c, d;
  1518. X{
  1519. X   PLINT ta, tb;
  1520. X
  1521. X   ta = *a;
  1522. X   tb = *b;
  1523. X
  1524. X   *a = round(ta*c + tb*d);
  1525. X   *b = round(tb*c - ta*d);
  1526. X}
  1527. X
  1528. Xvoid buildlist(x1,y1,x2,y2,x3,y3,dinc)
  1529. Xint x1, y1, x2, y2, x3, y3;
  1530. X{
  1531. X   int i;
  1532. X   int dx, dy, cstep, nstep, lines, ploty, plotx;
  1533. X   void addcoord();
  1534. X
  1535. X   dx = x2 - x1; dy = y2 - y1;
  1536. X
  1537. X   if(dy == 0) return;
  1538. X
  1539. X   cstep = (y2>y1 ? 1 : -1);
  1540. X   nstep = (y3>y2 ? 1 : -1);
  1541. X   if(y3 == y2) nstep = 0;
  1542. X
  1543. X   /* Build coordinate list */
  1544. X   lines = abs(dy)/dinc + 1;
  1545. X   if(cstep == 1  && y1 > 0)
  1546. X      ploty = (y1/dinc + 1)*dinc;
  1547. X   else if (cstep == -1 && y1 < 0)
  1548. X      ploty = (y1/dinc - 1)*dinc;
  1549. X   else
  1550. X      ploty = (y1/dinc)*dinc;
  1551. X
  1552. X   for(i=0; i<lines; i++) {
  1553. X      if(!betw(ploty,y1,y2)) break;
  1554. X      plotx = x1 + round(((float)(ploty-y1)*dx)/dy + .5);
  1555. X      /* Check for extremum at end point, otherwise add to coord list */
  1556. X      if(!((ploty == y1) || (ploty == y2 && nstep != cstep)))
  1557. X         addcoord(plotx,ploty);
  1558. X      ploty += cstep*dinc;
  1559. X   }
  1560. X}
  1561. X
  1562. Xvoid addcoord(x1, y1)
  1563. Xint x1, y1;
  1564. X{
  1565. X   short *temp;
  1566. X
  1567. X   if(bufferleng + 2 > buffersize) {
  1568. X      buffersize += 2*BINC;
  1569. X      temp = (short *)realloc((VOID *)buffer,buffersize*sizeof(short));
  1570. X      if(!temp) {
  1571. X         free((VOID *)buffer);
  1572. X         plexit("Out of memory in plfill!");
  1573. X      }
  1574. X      buffer = temp;
  1575. X   }
  1576. X
  1577. X   buffer[bufferleng++] = x1;
  1578. X   buffer[bufferleng++] = y1;
  1579. X}
  1580. X
  1581. Xint compare(pnum1, pnum2)
  1582. Xchar *pnum1, *pnum2;
  1583. X{
  1584. X   struct point *pnt1, *pnt2;
  1585. X
  1586. X   pnt1 = (struct point *)pnum1;
  1587. X   pnt2 = (struct point *)pnum2;
  1588. X
  1589. X   if(pnt1->y < pnt2->y)
  1590. X      return(-1);
  1591. X   else if(pnt1->y > pnt2->y)
  1592. X      return(1);
  1593. X
  1594. X   /* Only reach here if y coords are equal, so sort by x */
  1595. X   if(pnt1->x < pnt2->x)
  1596. X      return(-1);
  1597. X   else if(pnt1->x > pnt2->x)
  1598. X      return(1);
  1599. X
  1600. X   return(0);
  1601. X}
  1602. END_OF_FILE
  1603. if test 5226 -ne `wc -c <'src/plfill.c'`; then
  1604.     echo shar: \"'src/plfill.c'\" unpacked with wrong size!
  1605. fi
  1606. # end of 'src/plfill.c'
  1607. fi
  1608. if test -f 'src/plzbx.c' -a "${1}" != "-c" ; then 
  1609.   echo shar: Will not clobber existing file \"'src/plzbx.c'\"
  1610. else
  1611. echo shar: Extracting \"'src/plzbx.c'\" \(4379 characters\)
  1612. sed "s/^X//" >'src/plzbx.c' <<'END_OF_FILE'
  1613. X/* This draws a vertical line from (wx,wy1) to (wx,wy2)           */
  1614. X/*  which represents the vertical axis of a 3-d graph with data   */
  1615. X/*  values from "vmin" to "vmax". Depending on "opt", ticks and/or*/
  1616. X/*  subticks are placed on the line at major tick interval "tick" */
  1617. X/*  with "nsub" subticks between major ticks. If "tick" and/or    */
  1618. X/*  "nsub" is zero, automatic tick positions are computed         */
  1619. X
  1620. X/* B: Draws left-hand axis*/
  1621. X/* C: Draws right-hand axis*/
  1622. X/* I: Inverts tick marks (i.e. drawn to the left)  */
  1623. X/* L: Logarithmic axes, major ticks at decades, minor ticks at units*/
  1624. X/* M: Write numeric label on right axis*/
  1625. X/* N: Write numeric label on left axis*/
  1626. X/* S: Draw minor tick marks  */
  1627. X/* T: Draw major tick marks  */
  1628. X/* U: Writes left-hand label*/
  1629. X/* V: Writes right-hand label*/
  1630. X
  1631. X#include "plplot.h"
  1632. X#include <stdio.h>
  1633. X#include <math.h>
  1634. X
  1635. X#define betw(c,a,b) ((a <= c && c <= b) || (b <= c && c <= a))
  1636. X
  1637. Xstatic PLFLT xlog[8] =
  1638. X  {0.301030,0.477121,0.602060,0.698970,0.778151,0.845098,
  1639. X   0.903090,0.954243};
  1640. X
  1641. Xvoid plzbx(opt,label,right,dx,dy,wx,wy1,wy2,vmin,vmax,tick,nsub)
  1642. Xchar *opt, *label;
  1643. XPLFLT dx, dy, wx, wy1, wy2, vmin, vmax, tick;
  1644. XPLINT nsub, right;
  1645. X{
  1646. X      static char string[40];
  1647. X      PLINT lb,lc,li,ll,lm,ln,ls,lt,lu,lv;
  1648. X      PLINT i, mode, prec;
  1649. X      PLINT nsub1;
  1650. X      PLFLT xpmm, ypmm, defmaj, defmin, tick1;
  1651. X      PLFLT pos, tn, tp, temp;
  1652. X      PLFLT dwy, lambda, diag, major, minor, xmajor, xminor;
  1653. X      PLFLT ymajor, yminor, dxm, dym, xscl, xoff, yscl, yoff;
  1654. X
  1655. X      dwy = wy2 - wy1;
  1656. X
  1657. X      /* Tick and subtick sizes in device coords */
  1658. X
  1659. X      gpixmm(&xpmm,&ypmm);
  1660. X      gmaj(&defmaj,&major);
  1661. X      gmin(&defmin,&minor);
  1662. X
  1663. X      tick1=tick;
  1664. X      nsub1=nsub;
  1665. X
  1666. X      lb=stsearch(opt,'b');
  1667. X      lc=stsearch(opt,'c');
  1668. X      li=stsearch(opt,'i');
  1669. X      ll=stsearch(opt,'l');
  1670. X      lm=stsearch(opt,'m');
  1671. X      ln=stsearch(opt,'n');
  1672. X      ls=stsearch(opt,'s');
  1673. X      lt=stsearch(opt,'t');
  1674. X      lu=stsearch(opt,'u');
  1675. X      lv=stsearch(opt,'v');
  1676. X
  1677. X      if (lu && !right)
  1678. X         plztx("h",dx,dy,wx,wy1,wy2,(PLFLT)5.0,(PLFLT)0.5,(PLFLT)0.5,label);
  1679. X      if (lv && right)
  1680. X         plztx("h",dx,dy,wx,wy1,wy2,(PLFLT)-5.0,(PLFLT)0.5,(PLFLT)0.5,label);
  1681. X
  1682. X      if (right && !lc)
  1683. X         return;
  1684. X      if (!right && !lb)
  1685. X         return;
  1686. X
  1687. X      if (ll)
  1688. X         tick1 = (PLFLT)1.0;
  1689. X      if (lt)
  1690. X         pldtik(vmin,vmax,&tick1,&nsub1,&mode,&prec);
  1691. X
  1692. X      if ( (li && !right) || (!li && right) ) {
  1693. X        minor = -minor;
  1694. X        major = -major;
  1695. X      }
  1696. X
  1697. X      gwm(&xscl,&xoff,&yscl,&yoff);
  1698. X      dxm = dx * xscl;
  1699. X      dym = dy * yscl;
  1700. X      diag = sqrt(dxm*dxm + dym*dym);
  1701. X
  1702. X      xminor = minor * dxm/diag;
  1703. X      xmajor = major * dxm/diag;
  1704. X      yminor = minor * dym/diag;
  1705. X      ymajor = major * dym/diag;
  1706. X
  1707. X     /* Draw the line */
  1708. X
  1709. X      movwor(wx,wy1);
  1710. X      if (lt) {
  1711. X        tp=tick1*floor(vmin/tick1);
  1712. X        for(;;) {
  1713. X           tn=tp+tick1;
  1714. X           if (ls) {
  1715. X             if (ll) {
  1716. X               for (i=0; i <= 7; i++) {
  1717. X                 temp=tp+xlog[i];
  1718. X                 if (betw(temp,vmin,vmax)) {
  1719. X                   lambda = (temp-vmin)/(vmax-vmin);
  1720. X                   plstik(wcmmx(wx),wcmmy((PLFLT)(wy1+lambda*dwy)),xminor,yminor);
  1721. X                 }
  1722. X               }
  1723. X             }
  1724. X             else  {
  1725. X               for (i=1; i<= nsub1-1; i++)  {
  1726. X                 temp=tp+i*tick1/nsub1;
  1727. X                 if (betw(temp,vmin,vmax)) {
  1728. X                   lambda = (temp-vmin)/(vmax-vmin);
  1729. X                   plstik(wcmmx(wx),wcmmy((PLFLT)(wy1+lambda*dwy)),xminor,yminor);
  1730. X                 }
  1731. X               }
  1732. X             }
  1733. X           }
  1734. X           temp=tn;
  1735. X           if (!betw(temp,vmin,vmax))
  1736. X              break;
  1737. X           lambda = (temp-vmin)/(vmax-vmin);
  1738. X           plstik(wcmmx(wx),wcmmy((PLFLT)(wy1+lambda*dwy)),xmajor,ymajor);
  1739. X           tp=tn;
  1740. X        }
  1741. X      }
  1742. X
  1743. X      drawor(wx,wy2);
  1744. X
  1745. X      /* Label the line */
  1746. X
  1747. X      if (ln && lt) {
  1748. X        tp=tick1*floor(vmin/tick1);
  1749. X        for(tn=tp+tick1; betw(tn,vmin,vmax); tn+=tick1) {
  1750. X          if (!ll)
  1751. X            plform(tn,mode,prec,string);
  1752. X          else
  1753. X            sprintf(string,"10#u%d",round(tn));
  1754. X          pos=(tn-vmin)/(vmax-vmin);
  1755. X          if (ln && !right)
  1756. X             plztx("v",dx,dy,wx,wy1,wy2,(PLFLT)0.5,pos,(PLFLT)1.0,string);
  1757. X          if (lm && right)
  1758. X             plztx("v",dx,dy,wx,wy1,wy2,(PLFLT)-0.5,pos,(PLFLT)0.0,string);
  1759. X        }
  1760. X      }
  1761. X}
  1762. END_OF_FILE
  1763. if test 4379 -ne `wc -c <'src/plzbx.c'`; then
  1764.     echo shar: \"'src/plzbx.c'\" unpacked with wrong size!
  1765. fi
  1766. # end of 'src/plzbx.c'
  1767. fi
  1768. if test -f 'unix/dispatch.c' -a "${1}" != "-c" ; then 
  1769.   echo shar: Will not clobber existing file \"'unix/dispatch.c'\"
  1770. else
  1771. echo shar: Extracting \"'unix/dispatch.c'\" \(6432 characters\)
  1772. sed "s/^X//" >'unix/dispatch.c' <<'END_OF_FILE'
  1773. X#include "plplot.h"
  1774. X#include "dispatch.h"
  1775. X
  1776. Xvoid xtesetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1777. Xvoid xteselect PLARGS((PLINT or, char *file));
  1778. Xvoid xteinit PLARGS((void));
  1779. Xvoid xteline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1780. Xvoid xteclear PLARGS((void));
  1781. Xvoid xtepage PLARGS((void));
  1782. Xvoid xtetidy PLARGS((void));
  1783. Xvoid xtecolor PLARGS((PLINT color));
  1784. Xvoid xtetext PLARGS((void));
  1785. Xvoid xtegraph PLARGS((void));
  1786. Xvoid xtewidth PLARGS((PLINT width));
  1787. X
  1788. Xvoid tektsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1789. Xvoid tekfsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1790. Xvoid tektselect PLARGS((PLINT or, char *file));
  1791. Xvoid tekfselect PLARGS((PLINT or, char *file));
  1792. Xvoid tektinit PLARGS((void));
  1793. Xvoid tekfinit PLARGS((void));
  1794. Xvoid tekline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1795. Xvoid tektclear PLARGS((void));
  1796. Xvoid tekfclear PLARGS((void));
  1797. Xvoid tekpage PLARGS((void));
  1798. Xvoid tekttidy PLARGS((void));
  1799. Xvoid tekftidy PLARGS((void));
  1800. Xvoid tekcolor PLARGS((PLINT color));
  1801. Xvoid tektext PLARGS((void));
  1802. Xvoid tekgraph PLARGS((void));
  1803. Xvoid tekwidth PLARGS((PLINT width));
  1804. X
  1805. Xvoid dgsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1806. Xvoid dgselect PLARGS((PLINT or, char *file));
  1807. Xvoid dginit PLARGS((void));
  1808. Xvoid dgline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1809. Xvoid dgclear PLARGS((void));
  1810. Xvoid dgpage PLARGS((void));
  1811. Xvoid dgtidy PLARGS((void));
  1812. Xvoid dgcolor PLARGS((PLINT color));
  1813. Xvoid dgtext PLARGS((void));
  1814. Xvoid dggraph PLARGS((void));
  1815. Xvoid dgwidth PLARGS((PLINT width));
  1816. X
  1817. Xvoid hp7470setup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1818. Xvoid hp7470select PLARGS((PLINT or, char *file));
  1819. Xvoid hp7470init PLARGS((void));
  1820. Xvoid hp7470line PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1821. Xvoid hp7470clear PLARGS((void));
  1822. Xvoid hp7470page PLARGS((void));
  1823. Xvoid hp7470tidy PLARGS((void));
  1824. Xvoid hp7470color PLARGS((PLINT color));
  1825. Xvoid hp7470text PLARGS((void));
  1826. Xvoid hp7470graph PLARGS((void));
  1827. Xvoid hp7470width PLARGS((PLINT width));
  1828. X
  1829. Xvoid hp7580setup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1830. Xvoid hp7580select PLARGS((PLINT or, char *file));
  1831. Xvoid hp7580init PLARGS((void));
  1832. Xvoid hp7580line PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1833. Xvoid hp7580clear PLARGS((void));
  1834. Xvoid hp7580page PLARGS((void));
  1835. Xvoid hp7580tidy PLARGS((void));
  1836. Xvoid hp7580color PLARGS((PLINT color));
  1837. Xvoid hp7580text PLARGS((void));
  1838. Xvoid hp7580graph PLARGS((void));
  1839. Xvoid hp7580width PLARGS((PLINT width));
  1840. X
  1841. Xvoid impsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1842. Xvoid impselect PLARGS((PLINT or, char *file));
  1843. Xvoid impinit PLARGS((void));
  1844. Xvoid impline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1845. Xvoid impclear PLARGS((void));
  1846. Xvoid imppage PLARGS((void));
  1847. Xvoid imptidy PLARGS((void));
  1848. Xvoid impcolor PLARGS((PLINT color));
  1849. Xvoid imptext PLARGS((void));
  1850. Xvoid impgraph PLARGS((void));
  1851. Xvoid impwidth PLARGS((PLINT width));
  1852. X
  1853. Xvoid jetsetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1854. Xvoid jetselect PLARGS((PLINT or, char *file));
  1855. Xvoid jetinit PLARGS((void));
  1856. Xvoid jetline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1857. Xvoid jetclear PLARGS((void));
  1858. Xvoid jetpage PLARGS((void));
  1859. Xvoid jettidy PLARGS((void));
  1860. Xvoid jetcolor PLARGS((PLINT color));
  1861. Xvoid jettext PLARGS((void));
  1862. Xvoid jetgraph PLARGS((void));
  1863. Xvoid jetwidth PLARGS((PLINT width));
  1864. X
  1865. Xvoid pssetup PLARGS((PLFLT xdpi, PLFLT ydpi, PLINT xsize, PLINT ysize));
  1866. Xvoid psselect PLARGS((PLINT or, char *file));
  1867. Xvoid psinit PLARGS((void));
  1868. Xvoid psline PLARGS((PLINT x1, PLINT y1, PLINT x2, PLINT y2));
  1869. Xvoid psclear PLARGS((void));
  1870. Xvoid pspage PLARGS((void));
  1871. Xvoid pstidy PLARGS((void));
  1872. Xvoid pscolor PLARGS((PLINT color));
  1873. Xvoid pstext PLARGS((void));
  1874. Xvoid psgraph PLARGS((void));
  1875. Xvoid pswidth PLARGS((PLINT width));
  1876. X
  1877. XDISPATCH_TABLE plDispatchTable[] = {
  1878. X   /* Xterm routines */
  1879. X   {
  1880. X      /* This string appears in the device menu list. */
  1881. X      "Xterm Window",
  1882. X      /* Page Setup routine */
  1883. X      xtesetup,
  1884. X      /* Orientation and file name selection */
  1885. X      xteselect,
  1886. X      /* Device initialization function pointer. */
  1887. X      xteinit,
  1888. X      /* Function to draw line between two points */
  1889. X      xteline,
  1890. X      /* Clear screen (or eject page) function. */
  1891. X      xteclear,
  1892. X      /* New page set up. */
  1893. X      xtepage,
  1894. X      /* Tidy up device (flush buffers, close file, etc.) */
  1895. X      xtetidy,
  1896. X      /* Function to change pen color. */
  1897. X      xtecolor,
  1898. X      /* Switch to text mode. */
  1899. X      xtetext,
  1900. X      /* Switch to graphics mode. */
  1901. X      xtegraph,
  1902. X      /* Set pen width */
  1903. X      xtewidth
  1904. X   },
  1905. X   {
  1906. X      "Tektronix Terminal",
  1907. X      tektsetup,
  1908. X      tektselect,
  1909. X      tektinit,
  1910. X      tekline,
  1911. X      tektclear,
  1912. X      tekpage,
  1913. X      tekttidy,
  1914. X      tekcolor,
  1915. X      tektext,
  1916. X      tekgraph,
  1917. X      tekwidth
  1918. X   },
  1919. X   {
  1920. X      "DG300 Terminal",
  1921. X      dgsetup,
  1922. X      dgselect,
  1923. X      dginit,
  1924. X      dgline,
  1925. X      dgclear,
  1926. X      dgpage,
  1927. X      dgtidy,
  1928. X      dgcolor,
  1929. X      dgtext,
  1930. X      dggraph,
  1931. X      dgwidth
  1932. X   },
  1933. X   {
  1934. X      "HP 7470 Plotter File (HPGL Cartridge, Small Plotter)",
  1935. X      hp7470setup,
  1936. X      hp7470select,
  1937. X      hp7470init,
  1938. X      hp7470line,
  1939. X      hp7470clear,
  1940. X      hp7470page,
  1941. X      hp7470tidy,
  1942. X      hp7470color,
  1943. X      hp7470text,
  1944. X      hp7470graph,
  1945. X      hp7470width
  1946. X   },
  1947. X   {
  1948. X      "HP 7580 Plotter File (Large Plotter)",
  1949. X      hp7580setup,
  1950. X      hp7580select,
  1951. X      hp7580init,
  1952. X      hp7580line,
  1953. X      hp7580clear,
  1954. X      hp7580page,
  1955. X      hp7580tidy,
  1956. X      hp7580color,
  1957. X      hp7580text,
  1958. X      hp7580graph,
  1959. X      hp7580width
  1960. X   },
  1961. X   {
  1962. X      "Impress File",
  1963. X      impsetup,
  1964. X      impselect,
  1965. X      impinit,
  1966. X      impline,
  1967. X      impclear,
  1968. X      imppage,
  1969. X      imptidy,
  1970. X      impcolor,
  1971. X      imptext,
  1972. X      impgraph,
  1973. X      impwidth
  1974. X   },
  1975. X   {
  1976. X      "Tektronix File",
  1977. X      tekfsetup,
  1978. X      tekfselect,
  1979. X      tekfinit,
  1980. X      tekline,
  1981. X      tekfclear,
  1982. X      tekpage,
  1983. X      tekftidy,
  1984. X      tekcolor,
  1985. X      tektext,
  1986. X      tekgraph,
  1987. X      tekwidth
  1988. X   },
  1989. X   {
  1990. X      "LaserJet II Bitmap File (150 dpi)",
  1991. X      jetsetup,
  1992. X      jetselect,
  1993. X      jetinit,
  1994. X      jetline,
  1995. X      jetclear,
  1996. X      jetpage,
  1997. X      jettidy,
  1998. X      jetcolor,
  1999. X      jettext,
  2000. X      jetgraph,
  2001. X      jetwidth
  2002. X   },
  2003. X   {
  2004. X      "PostScript File",
  2005. X      pssetup,
  2006. X      psselect,
  2007. X      psinit,
  2008. X      psline,
  2009. X      psclear,
  2010. X      pspage,
  2011. X      pstidy,
  2012. X      pscolor,
  2013. X      pstext,
  2014. X      psgraph,
  2015. X      pswidth
  2016. X   }
  2017. X};
  2018. X
  2019. Xint npldrivers = (sizeof(plDispatchTable)/sizeof(struct dispatch_table));
  2020. END_OF_FILE
  2021. if test 6432 -ne `wc -c <'unix/dispatch.c'`; then
  2022.     echo shar: \"'unix/dispatch.c'\" unpacked with wrong size!
  2023. fi
  2024. # end of 'unix/dispatch.c'
  2025. fi
  2026. if test -f 'unix/impress.c' -a "${1}" != "-c" ; then 
  2027.   echo shar: Will not clobber existing file \"'unix/impress.c'\"
  2028. else
  2029. echo shar: Extracting \"'unix/impress.c'\" \(5079 characters\)
  2030. sed "s/^X//" >'unix/impress.c' <<'END_OF_FILE'
  2031. X/* This file contains the IMPRESS device dependent subroutines for */
  2032. X/* use with plplot. */
  2033. X
  2034. X#include "plplot.h"
  2035. X#include <stdio.h>
  2036. X#include <limits.h>
  2037. X
  2038. X#define SET_HV_SYSTEM   0315
  2039. X#define OPBYTE1         031
  2040. X#define OPBYTE2         0140
  2041. X#define SET_ABS_H       0207
  2042. X#define SET_ABS_V       0211
  2043. X#define OPWORDH1        0
  2044. X#define OPWORDH2        150
  2045. X#define OPWORDV1        0
  2046. X#define OPWORDV2        150
  2047. X#define ENDPAGE         0333
  2048. X
  2049. X#define BUFFPTS         50
  2050. X#define BUFFLENG        2*BUFFPTS
  2051. X
  2052. X#define IMPX            2999
  2053. X#define IMPY            2249
  2054. X
  2055. Xstatic FILE *OutFile;
  2056. Xstatic int porient;
  2057. Xstatic short *LineBuff;
  2058. Xstatic int select=0;
  2059. Xchar FileName[80];
  2060. X
  2061. Xvoid flushline(void);
  2062. X
  2063. Xvoid impsetup(xdpi,ydpi,xwid,ywid)
  2064. XPLINT xwid, ywid;
  2065. XPLFLT xdpi, ydpi;
  2066. X{
  2067. X}
  2068. X
  2069. X/* Open file.  Set up for graphics. */
  2070. Xvoid impinit()
  2071. X{
  2072. X      char response[80];
  2073. X      int ori;
  2074. X
  2075. X      smod(0);  /* not an interactive terminal */
  2076. X      scol(1);
  2077. X      swid(1);
  2078. X      setpxl(11.81,11.81);
  2079. X      
  2080. X      if(!select) {
  2081. X         printf("Landscape or portrait orientation? (0 or 1): ");
  2082. X         fgets(response,sizeof(response),stdin);
  2083. X         if(sscanf(response,"%d",&ori) != 1)
  2084. X            ori = 0;   /* carriage return defaults to landscape */
  2085. X      }
  2086. X      
  2087. X      porient = ori;
  2088. X      if(!porient)
  2089. X         setphy(0,IMPX,0,IMPY);
  2090. X      else
  2091. X         setphy(0,IMPY,0,IMPX);
  2092. X
  2093. X      OutFile = NULL;
  2094. X      while(!OutFile) {
  2095. X         if(!select) {
  2096. X            printf("Enter graphics command storage file name. ");
  2097. X            fgets(response,sizeof(response),stdin);
  2098. X            if(sscanf(response,"%s",FileName) != 1) {
  2099. X                printf("Invalid entry.n");
  2100. X                continue;
  2101. X            }
  2102. X         }
  2103. X         select = 0;
  2104. X         if ((OutFile = fopen(FileName,"w")) == NULL) 
  2105. X             printf("Can't open %s.\n",FileName);
  2106. X      }
  2107. X
  2108. X      LineBuff = (short *)malloc(BUFFLENG*sizeof(short));
  2109. X      if(LineBuff == NULL) {
  2110. X        printf("\nError in memory alloc in impini().\n");
  2111. X        exit(1);
  2112. X      }
  2113. X      fprintf(OutFile,"@Document(Language ImPress, jobheader off)");
  2114. X      fprintf(OutFile,"%c%c",SET_HV_SYSTEM,OPBYTE1);
  2115. X      fprintf(OutFile,"%c%c%c",SET_ABS_H,OPWORDH1,OPWORDH2);
  2116. X      fprintf(OutFile,"%c%c%c",SET_ABS_V,OPWORDV1,OPWORDV2);
  2117. X      fprintf(OutFile,"%c%c",SET_HV_SYSTEM,OPBYTE2);
  2118. X}
  2119. X
  2120. Xvoid impselect(ori,file)
  2121. XPLINT ori;
  2122. Xchar *file;
  2123. X{
  2124. X   porient = ori;
  2125. X   strncpy(FileName,file,sizeof(FileName)-1);
  2126. X   FileName[sizeof(FileName)-1] = '\0';
  2127. X   select = 1;
  2128. X}
  2129. X
  2130. X/* Sets the IMPRESS to text mode */
  2131. Xvoid imptext()
  2132. X{
  2133. X}
  2134. X
  2135. X/* Sets the IMPRESS to graphics mode */
  2136. Xvoid impgraph()
  2137. X{
  2138. X}
  2139. X
  2140. X/* Form feed */
  2141. Xvoid impclear()
  2142. X{
  2143. X     flushline();
  2144. X     fprintf(OutFile,"%c",ENDPAGE);
  2145. X}
  2146. X
  2147. Xstatic short FirstLine;
  2148. X
  2149. Xvoid imppage()
  2150. X{
  2151. X   FirstLine = 1;
  2152. X}
  2153. X
  2154. X/* May put something here someday */
  2155. Xvoid impcolor(colour)
  2156. XPLINT colour;
  2157. X{
  2158. X}
  2159. X
  2160. X#define SET_PEN       0350
  2161. X
  2162. Xstatic int penchange=0, penwidth;
  2163. X
  2164. Xvoid impwidth(width)
  2165. XPLINT width;
  2166. X{
  2167. X      if(width>0 && width <= 20) {
  2168. X        penwidth = width;
  2169. X        penchange = 1;
  2170. X      }
  2171. X}
  2172. X
  2173. X#define CREATE_PATH   0346
  2174. X#define DRAW_PATH     0352
  2175. X#define OPTYPE        017
  2176. X
  2177. Xstatic short count;
  2178. X
  2179. Xvoid impline(x1a,y1a,x2a,y2a)
  2180. XPLINT x1a,y1a,x2a,y2a;
  2181. X{
  2182. X      static int xold, yold;
  2183. X      int x1, y1, x2, y2;
  2184. X
  2185. X      if(!porient) {
  2186. X         x1 = x1a;
  2187. X         y1 = y1a;
  2188. X         x2 = x2a;
  2189. X         y2 = y2a;
  2190. X      }
  2191. X      else {
  2192. X         x1 = IMPX - y1a;
  2193. X         y1 = x1a;
  2194. X         x2 = IMPX - y2a;
  2195. X         y2 = x2a;
  2196. X      }
  2197. X
  2198. X      if(FirstLine) {
  2199. X        if(penchange) {
  2200. X          fprintf(OutFile,"%c%c",SET_PEN,(char)penwidth);
  2201. X          penchange = 0;
  2202. X        }
  2203. X        /* Add both points to path */
  2204. X        count = 0;
  2205. X        FirstLine = 0;
  2206. X        *(LineBuff+count++) = (short)x1;
  2207. X        *(LineBuff+count++) = (short)y1;
  2208. X        *(LineBuff+count++) = (short)x2;
  2209. X        *(LineBuff+count++) = (short)y2;
  2210. X      }
  2211. X      else if((count+2) < BUFFLENG && x1 == xold && y1 == yold) {
  2212. X        /* Add new point to path */
  2213. X        *(LineBuff+count++) = (short)x2;
  2214. X        *(LineBuff+count++) = (short)y2;
  2215. X      }
  2216. X      else {
  2217. X        /* Write out old path */
  2218. X        count /= 2;
  2219. X        fprintf(OutFile,"%c%c%c",CREATE_PATH,(char)count/256,(char)count%256);
  2220. X        fwrite((char *)LineBuff,sizeof(short),2*count,OutFile);
  2221. X        fprintf(OutFile,"%c%c",DRAW_PATH,OPTYPE);
  2222. X        
  2223. X        /* And start a new path */
  2224. X        if(penchange) {
  2225. X          fprintf(OutFile,"%c%c",SET_PEN,(char)penwidth);
  2226. X          penchange = 0;
  2227. X        }
  2228. X        count = 0;
  2229. X        *(LineBuff+count++) = (short)x1;
  2230. X        *(LineBuff+count++) = (short)y1;
  2231. X        *(LineBuff+count++) = (short)x2;
  2232. X        *(LineBuff+count++) = (short)y2;
  2233. X      }
  2234. X
  2235. X      xold = x2;
  2236. X      yold = y2;
  2237. X}
  2238. X      
  2239. Xvoid flushline()
  2240. X{
  2241. X   count /= 2;
  2242. X   fprintf(OutFile,"%c%c%c",CREATE_PATH,(char)count/256,(char)count%256);
  2243. X   fwrite((char *)LineBuff,sizeof(short),2*count,OutFile);
  2244. X   fprintf(OutFile,"%c%c",DRAW_PATH,OPTYPE);
  2245. X   FirstLine = 1;
  2246. X}
  2247. X/* Close graphics file */
  2248. Xvoid imptidy()
  2249. X{
  2250. X      flushline();
  2251. X      fprintf(OutFile,"%c",ENDPAGE);
  2252. X      free((char *)LineBuff);
  2253. X      fclose(OutFile);
  2254. X      select = 0;
  2255. X}
  2256. END_OF_FILE
  2257. if test 5079 -ne `wc -c <'unix/impress.c'`; then
  2258.     echo shar: \"'unix/impress.c'\" unpacked with wrong size!
  2259. fi
  2260. # end of 'unix/impress.c'
  2261. fi
  2262. if test -f 'unix/laserjetii.c' -a "${1}" != "-c" ; then 
  2263.   echo shar: Will not clobber existing file \"'unix/laserjetii.c'\"
  2264. else
  2265. echo shar: Extracting \"'unix/laserjetii.c'\" \(4262 characters\)
  2266. sed "s/^X//" >'unix/laserjetii.c' <<'END_OF_FILE'
  2267. X/* This file contains the Laser Jet II device dependent subroutines for */
  2268. X/* use with plplot. Only the 150 dpi mode is supported.  The others     */
  2269. X/* (75,100,300) should work by just changing the value of DPI and       */
  2270. X/* changing the values passed to setphy in DEVICE.f77                   */
  2271. X
  2272. X#include "plplot.h"
  2273. X#include <stdio.h>
  2274. X#include <string.h>
  2275. X#include <math.h>
  2276. X
  2277. X#define DPI      150            /* Resolution Dots per Inch */
  2278. X#define CURX     51
  2279. X#define CURY     61
  2280. X#define ESC      0x1b
  2281. X#define FF       0x0c
  2282. X#define XDOTS    1104           /* # dots across */
  2283. X#define YDOTS    1410           /* # dots down   */
  2284. X#define BPROW    XDOTS/8        /* # bytes across */
  2285. X#define NBYTES   BPROW*YDOTS    /* total number of bytes */
  2286. X
  2287. X#define JETX     1409
  2288. X#define JETY     1103
  2289. X
  2290. Xstatic FILE *OutFile;
  2291. Xstatic int porient;
  2292. Xstatic int select=0;
  2293. Xchar FileName[80];
  2294. X
  2295. X/* bitmap contains a pointer to an area of memory NBYTES in size */
  2296. Xstatic char *bitmap;
  2297. X
  2298. Xvoid jetsetup(xdpi, ydpi, xwid, ywid)
  2299. XPLINT xwid, ywid;
  2300. XPLFLT xdpi, ydpi;
  2301. X{
  2302. X}
  2303. X
  2304. X/* Opens the file for binary mode. */
  2305. Xvoid jetinit()
  2306. X{
  2307. X  char response[80];
  2308. X  int ori;
  2309. X
  2310. X  smod(0);  /* not an interactive terminal */
  2311. X  scol(1);
  2312. X  swid(1);
  2313. X  setpxl(5.905,5.905);
  2314. X  
  2315. X  if(!select) {
  2316. X     printf("Landscape or portrait orientation? (0 or 1): ");
  2317. X     fgets(response,sizeof(response),stdin);
  2318. X     if(sscanf(response,"%d",&ori) != 1)
  2319. X        ori = 0;   /* carriage return defaults to landscape */
  2320. X  }
  2321. X  
  2322. X  porient = ori;
  2323. X  if(!porient)
  2324. X     setphy(0,JETX,0,JETY);
  2325. X  else
  2326. X     setphy(0,JETY,0,JETX);
  2327. X
  2328. X  OutFile = NULL;
  2329. X  while(!OutFile) {
  2330. X     if(!select) {
  2331. X        printf("Enter graphics command storage file name. ");
  2332. X        fgets(response,sizeof(response),stdin);
  2333. X        if(sscanf(response,"%s",FileName) != 1) {
  2334. X            printf("Invalid entry.n");
  2335. X            continue;
  2336. X        }
  2337. X     }
  2338. X     if ((OutFile = fopen(FileName,"w")) == NULL) 
  2339. X         printf("Can't open %s.\n",FileName);
  2340. X     select = 0;
  2341. X  }
  2342. X
  2343. X  /* Allocate storage for bit map matrix */
  2344. X  if((bitmap = (char *)calloc(NBYTES,sizeof(char))) == NULL)
  2345. X   printf("Out of memory in call to calloc \n");
  2346. X
  2347. X  /* Reset Printer */
  2348. X  fprintf(OutFile,"%cE",ESC);
  2349. X}
  2350. X
  2351. Xvoid jetselect(ori,file)
  2352. XPLINT ori;
  2353. Xchar *file;
  2354. X{
  2355. X   porient = ori;
  2356. X   strncpy(FileName,file,sizeof(FileName)-1);
  2357. X   FileName[sizeof(FileName)-1] = '\0';
  2358. X   select = 1;
  2359. X}
  2360. X
  2361. X/* Set JET to test mode */
  2362. Xvoid jettext()
  2363. X{
  2364. X  /* do nothing here */
  2365. X}
  2366. X
  2367. X/* Set JET to graphics mode */
  2368. Xvoid jetgraph()
  2369. X{
  2370. X  /* Do nothing here */
  2371. X}
  2372. X
  2373. X/* Print out page */
  2374. Xvoid jetclear()
  2375. X{
  2376. X  int i,j;
  2377. X
  2378. X  /* First move cursor to origin */
  2379. X  fprintf(OutFile,"%c*p%dX",ESC,CURX);
  2380. X  fprintf(OutFile,"%c*p%dY",ESC,CURY);
  2381. X
  2382. X  /* Then put Laser Printer in 150 dpi mode */
  2383. X  fprintf(OutFile,"%c*t%dR",ESC,DPI);
  2384. X  fprintf(OutFile,"%c*r1A",ESC);
  2385. X
  2386. X  /* Write out raster data */
  2387. X  for(j=0;j<YDOTS;j++){
  2388. X    fprintf(OutFile,"%c*b%dW",ESC,BPROW);
  2389. X    for(i=0;i<BPROW;i++)
  2390. X      putc(*(bitmap+i+j*BPROW),OutFile);
  2391. X  }
  2392. X
  2393. X  /* End raster graphics and send Form Feed */
  2394. X  fprintf(OutFile,"%c*rB",ESC);
  2395. X  fprintf(OutFile,"%c",FF);
  2396. X
  2397. X  /* Finally, clear out bitmap storage area */
  2398. X  memset(bitmap,'\0',NBYTES);
  2399. X}
  2400. X
  2401. Xvoid jetpage()
  2402. X{
  2403. X}
  2404. X
  2405. X/* Change color */
  2406. Xvoid jetcolor(colour)
  2407. XPLINT colour;
  2408. X{
  2409. X}
  2410. X
  2411. Xvoid jetwidth(width)
  2412. XPLINT width;
  2413. X{
  2414. X}
  2415. X
  2416. X/* Function to draw the line in the bitmap */
  2417. Xvoid jetline(x1a,y1a,x2a,y2a)
  2418. XPLINT x1a,y1a,x2a,y2a;
  2419. X{
  2420. X int i,x1,y1,x2,y2;
  2421. X float length,fx,fy,dx,dy;
  2422. X void setpoint();
  2423. X if(!porient) {
  2424. X   x1 = x1a;
  2425. X   y1 = y1a;
  2426. X   x2 = x2a;
  2427. X   y2 = y2a;
  2428. X }
  2429. X else {
  2430. X   x1 = JETX - y1a;
  2431. X   y1 = x1a;
  2432. X   x2 = JETX - y2a;
  2433. X   y2 = x2a;
  2434. X }
  2435. X
  2436. X length = (float)sqrt((double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
  2437. X if(length == 0.)
  2438. X   length = 1.;
  2439. X dx = (x2 - x1)/length;
  2440. X dy = (y2 - y1)/length;
  2441. X
  2442. X fx = x1;
  2443. X fy = y1;
  2444. X setpoint(x1,y1);
  2445. X setpoint(x2,y2);
  2446. X
  2447. X for(i=1;i<=(int)length;i++)
  2448. X  setpoint((int)(fx+=dx),(int)(fy+=dy));
  2449. X}
  2450. X
  2451. Xstatic char mask[8] = {'\200','\100','\040','\020','\010','\004','\002','\001'};
  2452. X
  2453. X/* Function to set a bit in the bitmap */
  2454. Xstatic void setpoint(x,y)
  2455. Xint x,y;
  2456. X{
  2457. X int index;
  2458. X index = x/8 + y*BPROW;
  2459. X *(bitmap+index) = *(bitmap+index) | mask[x%8];
  2460. X}
  2461. X
  2462. X/* Reset printer and close file */
  2463. Xvoid jettidy()
  2464. X{
  2465. X  jetclear();
  2466. X  /* Reset Printer */
  2467. X  fprintf(OutFile,"%cE",ESC);
  2468. X  fclose(OutFile);
  2469. X  free((char *)bitmap);
  2470. X}
  2471. END_OF_FILE
  2472. if test 4262 -ne `wc -c <'unix/laserjetii.c'`; then
  2473.     echo shar: \"'unix/laserjetii.c'\" unpacked with wrong size!
  2474. fi
  2475. # end of 'unix/laserjetii.c'
  2476. fi
  2477. echo shar: End of archive 5 \(of 12\).
  2478. cp /dev/null ark5isdone
  2479. MISSING=""
  2480. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  2481.     if test ! -f ark${I}isdone ; then
  2482.     MISSING="${MISSING} ${I}"
  2483.     fi
  2484. done
  2485. if test "${MISSING}" = "" ; then
  2486.     echo You have unpacked all 12 archives.
  2487.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2488. else
  2489.     echo You still need to unpack the following archives:
  2490.     echo "        " ${MISSING}
  2491. fi
  2492. ##  End of shell archive.
  2493. exit 0
  2494. -- 
  2495. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  2496.     amiga@cs.odu.edu    
  2497. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  2498. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  2499.  
  2500. Comments, questions, and suggestions s should be addressed to ``amiga-request''
  2501. (only use ``amiga'' for submissions) at the above addresses.
  2502.